#include "FunctionCallNode.h"

#include "Output/Console.h"
#include "ScriptCompiler/Token/Token.h"
#include "ScriptCompiler/AST/TypeNode.h"

CString CFunctionCallNode::GetFunctionName()
{
    return Name->ToString();
}

void CFunctionCallNode::DebugPrint(int32_t InDepth)
{
    //print depth
    for (int32_t i = 0; i < InDepth; i++)
    {
        WH::Print(U"\t");
    }

    //print name 
    WH::Print(Name->ToString());

    //print generic type
    if (GenericArguments.Num() > 0)
    {
        WH::Print(U"<");
        for (uint64_t i = 0; i < GenericArguments.Num(); i++)
        {
            if (i != 0)
            {
                WH::Print(U",");
            }
            GenericArguments[i]->DebugPrint(0);
        }
        WH::Print(U">");
    }

    //print left bracket
    WH::Print(U"(");

    //print arguments
    for (int32_t i = 0; i < Arguments.Num(); i++)
    {
        Arguments[i]->DebugPrint(0);

        if (i != Arguments.Num() - 1)
        {
            WH::Print(U",");
        }
    }

    //print right bracket
    WH::Print(U")");
}
